<%--
  Created by IntelliJ IDEA.
  User: jshand
  Date: 2022/12/3
  Time: 11:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script>


        function reItem(button){
            button.parentNode.parentNode.remove();
            //重新计算下所有都 input的 name
        }

    </script>
</head>
<body>

<form method="post" action="${pageContext.request.contextPath}/save4">

<%--    sb.append(", username=").append(username);--%>
<%--    sb.append(", password=").append(password);--%>
<%--    sb.append(", realname=").append(realname);--%>
<%--    sb.append(", telephone=").append(telephone);--%>
<%--    sb.append(", deptId=").append(deptId);--%>
<%--    sb.append(", userType=").append(userType);--%>
    <h3>用户信息</h3>
    用户名: <input type="text" name="user.username"  value="" /> <br>
    password: <input type="text" name="user.password"  value="" /> <br>
    realname: <input type="text" name="user.realname"  value="" /> <br>
    telephone: <input type="text" name="user.telephone"  value="" /> <br>

    <h3>角色信息</h3>
    角色名称: <input type="text" name="role.name"  value="" /> <br>


    <input type="submit" value="提交" />

</form>




<h3>用户列表</h3>

<form action="${pageContext.request.contextPath}/delBatch" method="post">
     <input type="submit" value="批量删除" />
    <table width="100%" cellpadding="0" cellspacing="0" border="1">
        <tr>
            <td>全选/反选</td>
            <td>用户名</td>
            <td>密码</td>
            <td>昵称</td>
        </tr>
        <tr>
            <td><input type="checkbox" value="1" name="id" /> </td>
            <td>用户名1</td>
            <td>密码1</td>
            <td>昵称2</td>
        </tr>
        <tr>
            <td><input type="checkbox" value="2" name="id" /> </td>
            <td>用户名2</td>
            <td>密码2</td>
            <td>昵称2</td>
        </tr>

        <tr>
            <td><input type="checkbox" value="3" name="id" /> </td>
            <td>用户名3</td>
            <td>密码3</td>
            <td>昵称3</td>
        </tr>
    </table>



</form>



<h3>批量添加用户</h3>
<form action="${pageContext.request.contextPath}/saveUserList" method="post">

    <table>
        <tr>
            <td>用户名</td>
            <td>密码</td>
            <td>昵称</td>
            <td>操作</td>
        </tr>

        <tr>
            <td><input type="text" name="userList[0].username"/></td>
            <td><input type="text" name="userList[0].password"/></td>
            <td><input type="text" name="userList[0].realname"/></td>
            <td>
                <button onclick="reItem(this)">移除</button>
            </td>
        </tr>
        <tr>
            <td><input type="text" name="userList[1].username"/></td>
            <td><input type="text" name="userList[1].password"/></td>
            <td><input type="text" name="userList[1].realname"/></td>
            <td><button onclick="reItem(this)">移除</button></td>
        </tr>

        <tr>
            <td><input type="text" name="userList[2].username"/></td>
            <td><input type="text" name="userList[2].password"/></td>
            <td><input type="text" name="userList[2].realname"/></td>
            <td><button onclick="reItem(this)">移除</button></td>
        </tr>

    </table>

    <input type="submit" value="批量保存">

</form>





<h3>传递Map类型参数</h3>

<form action="${pageContext.request.contextPath}/saveAccount">


    <table>
        <tr>
            <td>账户名</td>
            <td><input type="text" name="accountName"></td>
        </tr>
        <tr>
            <td>账户余额</td>
            <td><input type="text" name="amount"></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="新增账户"></td>
        </tr>
    </table>


</form>






</body>
</html>
